package model;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;

public class Circle extends Shape {

    private int radius;
    private Color fill;

    public Circle(int x, int y, int stroke, Color stroke_color, int radius,
	    Color fill) {
	super(x, y, stroke, stroke_color);
	this.radius = radius;
	this.fill = fill;
    }

    public int getRadius() {
	return radius;
    }

    public void setRadius(int radius) {
	this.radius = radius;
    }

    public Color getFill() {
	return fill;
    }

    public void setFill(Color fill) {
	this.fill = fill;
    }

    @Override
    public void draw(Graphics g, float zoom_scale) {

	Graphics2D g2 = (Graphics2D) g;

	// Outline
	if (this.getStrokeColor() != null) {
	    g2.setStroke(new BasicStroke(getStrokeWidth()));
	    g.setColor(getStrokeColor());
	    g.drawOval((int) ((getX() - getRadius()) * zoom_scale),
		    (int) ((getY() - getRadius()) * zoom_scale),
		    (int) (getRadius() * 2 * zoom_scale),
		    (int) (getRadius() * 2 * zoom_scale));
	}
	// Fill
	if (this.getFill() != null) {
	    g.setColor(getFill());
	    g.fillOval((int) ((getX() - getRadius()) * zoom_scale),
		    (int) ((getY() - getRadius()) * zoom_scale),
		    (int) (getRadius() * 2 * zoom_scale) - 1,
		    (int) (getRadius() * 2 * zoom_scale) - 1);
	}

    }

}
